package com.microsoft.ocr.mlkit.utils;

import android.graphics.Rect;

import java.io.Serializable;
import java.util.HashMap;
import java.util.Map;

/**
 * Name: ResultBean
 * Author: lloydfinch
 * Function: ResultBean
 * Date: 2022/3/14 6:09 下午
 * Modify: lloydfinch 2022/3/14 6:09 下午
 */
public class ResultBean implements Serializable {
    public static Map<Integer, String> formats = new HashMap<>();

    static {
        formats.put(-1, "FORMAT_UNKNOWN");
        formats.put(0, "FORMAT_ALL_FORMATS");
        formats.put(1, "FORMAT_CODE_128");
        formats.put(2, "FORMAT_CODE_39");
        formats.put(4, "FORMAT_CODE_93");
        formats.put(8, "FORMAT_CODABAR");
        formats.put(16, "FORMAT_DATA_MATRIX");
        formats.put(32, "FORMAT_EAN_13");
        formats.put(64, "FORMAT_EAN_8");
        formats.put(128, "FORMAT_ITF");
        formats.put(256, "FORMAT_QR_CODE");
        formats.put(512, "FORMAT_UPC_A");
        formats.put(1024, "FORMAT_UPC_E");
        formats.put(2048, "FORMAT_PDF417");
        formats.put(4096, "FORMAT_AZTEC");
    }

    public Rect boundingbox;
    public String type;
    public String text;
    public String base64;

    public ResultBean(Rect boundingbox, int type, String text, String base64) {
        this.boundingbox = boundingbox;
        this.type = getType(type);
        this.text = text;
        this.base64 = base64;
    }

    public static String getType(int type) {
        return formats.get(type);
    }
}
